gdk-pixbuf-loader.c: Fixed init function to properly initialize all
authorMichael Fulbright <drmike@src.gnome.org>
Wed, 27 Oct 1999 16:41:44 +0000 (16:41 +0000)
committerMichael Fulbright <drmike@src.gnome.org>
Wed, 27 Oct 1999 16:41:44 +0000 (16:41 +0000)
structure members.

testpixbuf.c: Added call to close and destroy pixbuf loader properly.

demos/testpixbuf.c
gdk-pixbuf/gdk-pixbuf-loader.c
gtk/gdk-pixbuf-loader.c

index 35c93167d2ea093d750f5a7bb51bef8d0ac3a47e..20dc5f79a60c90863beeb61d57f7944009c0cfbf 100644 (file)
@@ -452,21 +452,24 @@ main (int argc, char **argv)
                                found_valid = TRUE;
                        }
                }
-       }
 
-       pixbuf_loader = gdk_pixbuf_loader_new ();
-       file = fopen ("/usr/share/pixmaps/up2date.png", "r");
-       g_assert (file != NULL);
-
-       while (TRUE) {
-               val = fgetc (file);
-               if (val == EOF)
-                       break;
-               buf = (guint) val;
-               if (gdk_pixbuf_loader_write (GDK_PIXBUF_LOADER (pixbuf_loader), &buf, 1) == FALSE)
-                       break;
+               pixbuf_loader = gdk_pixbuf_loader_new ();
+               file = fopen (argv[1], "r");
+               g_assert (file != NULL);
+               
+               while (TRUE) {
+                       val = fgetc (file);
+                       if (val == EOF)
+                               break;
+                       buf = (guint) val;
+                       if (gdk_pixbuf_loader_write (GDK_PIXBUF_LOADER (pixbuf_loader), &buf, 1) == FALSE)
+                               break;
+               }
+               gdk_pixbuf_loader_close (GDK_PIXBUF_LOADER (pixbuf_loader));
+               gtk_object_destroy (pixbuf_loader);
+               fclose (file);
+               
        }
-       fclose (file);
 
        if (found_valid)
                gtk_main ();
index ecb1b071f8e4b0a2b63f20b6acc5937ec6e5261b..efc132d265534929b2aa76d0fbccf6dc31e9143a 100644 (file)
@@ -145,6 +145,7 @@ gdk_pixbuf_loader_init (GdkPixbufLoader *loader)
        priv = g_new (GdkPixbufLoaderPrivate, 1);
        loader->private = priv;
 
+       priv->image_module=NULL;
        priv->pixbuf = NULL;
        priv->closed = FALSE;
        priv->buf_offset = 0;
index ecb1b071f8e4b0a2b63f20b6acc5937ec6e5261b..efc132d265534929b2aa76d0fbccf6dc31e9143a 100644 (file)
@@ -145,6 +145,7 @@ gdk_pixbuf_loader_init (GdkPixbufLoader *loader)
        priv = g_new (GdkPixbufLoaderPrivate, 1);
        loader->private = priv;
 
+       priv->image_module=NULL;
        priv->pixbuf = NULL;
        priv->closed = FALSE;
        priv->buf_offset = 0;